﻿<UserControl x:Class="Samba.Modules.SettingsModule.WorkPeriods.WorkPeriodsView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:FlexButton="clr-namespace:FlexButton;assembly=FlexButton"
     xmlns:Common="clr-namespace:Samba.Presentation.Common;assembly=Samba.Presentation.Common"
     xmlns:VirtualKeyboard="clr-namespace:Samba.Presentation.Common.VirtualKeyboard;assembly=Samba.Presentation.Common"
     mc:Ignorable="d" d:DesignHeight="600" d:DesignWidth="800" FontSize="20" xmlns:lex="http://schemas.root-project.org/xaml/presentation">
    <Grid>
        <TabControl SelectedIndex="{Binding ActiveScreen}">
            <TabControl.ItemContainerStyle>
                <Style TargetType="{x:Type TabItem}">
                    <Setter Property="Visibility" Value="Collapsed" />
                </Style>
            </TabControl.ItemContainerStyle>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <ListBox Grid.Column="0" ItemsSource="{Binding WorkPeriods}" FontSize="16">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Margin="4" Text="{Binding WorkPeriodLabel}" />
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
                <StackPanel Grid.Column="1" Margin="10" MinWidth="150">
                    <TextBlock Margin="0,0,0,10" FontSize="16" Text="{Binding LastEndOfDayLabel}" />
                    <FlexButton:FlexButton Margin="0,0,0,10" Height="40" Command="{Binding DisplayStartOfDayScreenCommand}"
                         Content="{Binding DisplayStartOfDayScreenCommand.Caption}" />
                    <FlexButton:FlexButton Margin="0,0,0,10" Height="40" Command="{Binding DisplayEndOfDayScreenCommand}"
                         Content="{Binding DisplayEndOfDayScreenCommand.Caption}" />
                    <TextBlock FontSize="16" Foreground="Red" FontWeight="Bold" Text="{Binding OpenTicketLabel}" />
                    <StackPanel Visibility="{Binding IsShutdownRequestVisible,Converter={StaticResource VisibilityConverter}}">
                        <TextBlock FontSize="16" Foreground="Red" FontWeight="Bold" Text="{Binding ConnectionCountLabel}" />
                        <FlexButton:FlexButton Margin="0,0,0,10" Height="40" Command="{Binding RequestShutdownCommand}"
                            Content="{Binding RequestShutdownCommand.Caption}" />
                    </StackPanel>
                </StackPanel>
            </Grid>
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="auto" />
                </Grid.RowDefinitions>
                <StackPanel Grid.Row="0">
                    <TextBlock Text="{LocText Description}" />
                    <TextBox Text="{Binding StartDescription}" Name="StartDescriptionEditor" Loaded="StartDescriptionEditor_Loaded" />
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="auto" />
                            <ColumnDefinition Width="auto" />
                        </Grid.ColumnDefinitions>
                        <GroupBox Grid.Column="0" HorizontalAlignment="Left" Header="{LocText CashContent}">
                            <UniformGrid Rows="2" HorizontalAlignment="Left">
                                <TextBlock Margin="5" Text="{LocText Cash}" />
                                <TextBlock Margin="5" Text="{LocText CreditCard}" />
                                <TextBlock Margin="5" Text="{LocText Voucher}" />
                                <Common:FilteredTextBox MinWidth="150" Margin="5" Text="{Binding CashAmount,StringFormat='{}{0:#,##.##}',UpdateSourceTrigger=PropertyChanged,Mode=TwoWay,FallbackValue=0}"
                                     Type="Number" HorizontalAlignment="Left" TextAlignment="Right" />
                                <Common:FilteredTextBox MinWidth="150" Margin="5" Text="{Binding CreditCardAmount,StringFormat='{}{0:#,##.##}',UpdateSourceTrigger=PropertyChanged,Mode=TwoWay,FallbackValue=0}"
                                     Type="Number" HorizontalAlignment="Left" TextAlignment="Right" />
                                <Common:FilteredTextBox MinWidth="150" Margin="5" Text="{Binding TicketAmount,StringFormat='{}{0:#,##.##}',UpdateSourceTrigger=PropertyChanged,Mode=TwoWay,FallbackValue=0}"
                                     Type="Number" HorizontalAlignment="Left" TextAlignment="Right" />
                            </UniformGrid>
                        </GroupBox>
                        <StackPanel Grid.Column="1" Margin="0,10,0,0">
                            <FlexButton:FlexButton MinWidth="180" Margin="5" Height="40" Command="{Binding StartOfDayCommand}"
                                 Content="{Binding StartOfDayCommand.Caption}" />
                            <FlexButton:FlexButton MinWidth="180" Margin="5" Height="40" Command="{Binding CancelCommand}"
                                 Content="{Binding CancelCommand.Caption}" />
                        </StackPanel>
                    </Grid>
                </StackPanel>
                <Viewbox Grid.Row="1">
                    <VirtualKeyboard:KeyboardView>
                    </VirtualKeyboard:KeyboardView>
                </Viewbox>
            </Grid>
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="auto" />
                </Grid.RowDefinitions>
                <StackPanel>
                    <TextBlock Text="{LocText Description}" />
                    <TextBox Text="{Binding StartDescription}" Name="EndDescriptionEditor" Loaded="EndDescriptionEditor_Loaded" />
                    <StackPanel Orientation="Horizontal">
                        <FlexButton:FlexButton MinWidth="150" Margin="0,5,5,5" Height="40" Command="{Binding EndOfDayCommand}"
                             Content="{Binding EndOfDayCommand.Caption}" />
                        <FlexButton:FlexButton MinWidth="150" Margin="5" Height="40" Command="{Binding CancelCommand}"
                             Content="{Binding CancelCommand.Caption}" />
                    </StackPanel>
                </StackPanel>
                <Viewbox Grid.Row="1">
                    <VirtualKeyboard:KeyboardView>
                    </VirtualKeyboard:KeyboardView>
                </Viewbox>
            </Grid>
        </TabControl>
    </Grid>
</UserControl>